<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="/WEB-INF/views/modules/commons/head.jsp" %>
    <%--多选css--%>
    <link rel="stylesheet" href="<s:url value="/assets/web/js/multiSelect/css/fselect.css"></s:url>">
    <!-- header -->
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
    <title>绩效考核</title>
    <style>
        .nav {
            margin-left: 0;
        }

        .nav > li > a:focus, .nav > li > a:hover {
            text-decoration: none;
            background-color: #33CCFF !important;
        }

        #gview_gridTable .ui-jqgrid-bdiv {
            max-height: 450px;
        !important;
        }

        #main-container {
            padding-top: 45px;
            position: relative;
            height: calc(100%);
            margin-left: 17.5%;
            margin-top: 60px;
        }

        .modal-dialog {
            z-index: 9999999;
        }

        @media (min-width: 768px) {
            .modal-content {
                -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
                box-shadow: 0 -2px 20px rgba(0, 0, 0, .5) !important;
            }
        }

        #userScoreTab tr th {
            background: #337ab7;
            color: #fff;
            text-align: center;
            padding: 5px 23px;
            border: 1px solid #ccc;
        }

        #userScoreTab tr td {
            padding: 5px;
            text-align: center;
            border: 1px solid #ccc;
        }

        #userScoreTab_2 tr th {
            background: #337ab7;
            color: #fff;
            text-align: center;
            padding: 5px 20px;
            border: 1px solid #ccc;
        }

        #userScoreTab_2 tr td {
            padding: 5px;
            text-align: center;
            border: 1px solid #ccc;
        }

        .search-row {
            margin-left: 7px !important;
        }
    </style>
</head>
<body class="bgcolor" style="background-color: #fff !important;">
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>


<!-- /section:basics/navbar.layout -->
<table></table>
<div class="main-container" id="main-container">
    <%--搜索查询--%>
    <div class="row search-row">
        <div class="col-xs-2">
            <input type="text" class="form-control" id="searchWord"
                   placeholder="请输入要搜索的关键词">
        </div>
        <div class="col-xs-1" style="right: 23px;">
            <button class="btn btn-large btn-primary" id="query">搜索</button>
        </div>
        <div class="col-xs-2" style="right: 75px;">
            <select id="invalid_select" class="form-control">
                <option value="">选择得分类型</option>
                <option value="">全部得分</option>
                <option value="0">有效得分</option>
                <option value="1">失效得分</option>
            </select>
        </div>
        <div class="col-xs-2" style="right: 100px;">
            <select id="checkType_select" class="form-control">
                <option value="">选择考核类别</option>
                <option value="">全部类别</option>
                <option value="督查">督查单位</option>
                <option value="业主单位经办人">业主单位经办人</option>
                <option value="业主单位责任人">业主单位责任人</option>
                <option value="审批部门经办人">审批部门经办人</option>
                <option value="审批部门责任人">审批部门责任人</option>
                <option value="攻坚任务">攻坚任务</option>
            </select>
        </div>
        <div class="col-xs-1" style="right: 60px;">
            <button class="btn btn-large btn-default clickMe" id="more" style="right: 65px;">更多∨</button>
            <%--<button class="btn btn-large btn-success" id="exportTable">导出报表</button>--%>
            <%--<button class="btn btn-large btn-default" id="downLoad">下载评分标准</button>--%>
        </div>
        <div class="col-xs-4" style="left: -20px;">
            <div class="pull-right">
                <button class="btn btn-large btn-danger" id="gradepoint">考核记录</button>
                <button class="btn btn-large btn-danger" id="showSummary">考核汇总</button>
            </div>
        </div>
    </div>
    <div id="more_show" class="col-xs-12 clearfix" style="margin: 5px 0px 0px 5px;" hidden>
        <button class="btn btn-large btn-success" id="exportTable">导出报表</button>
        <button class="btn btn-large btn-default" id="downLoad">下载评分标准</button>
    </div>
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <!-- jqGrid表格 -->
                        <table id="gridTable"></table>
                        <!-- jqGrid工具类 -->
                        <div id="gridPager"></div>
                        <!-- 查询对话框 -->
                        <div style="display: none;">
                            <div class="row" id="queryDialog"></div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
                <div class="row" style="margin-left: 2px;">
                    * 双击列表可查看绩效详情
                </div>
            </div><!-- /.page-content -->
            <div>
                <div class="page-content" style="float:left;">
                    <div style="float: left; margin-right: 50px;" class="userScoreDiv">
                        <h3 style="font-weight: 600;margin-top: 0px;">最新绩效得分:</h3>
                        <div id="yhdf"></div>
                    </div>
                    <div style="float: left;">
                        <h3 style="font-weight: 600;margin-top: 0px;">得分统计:</h3>
                        <div id="dftj">
                        </div>
                    </div>
                    <div style="padding: 10px 0px; clear: both;" class="userScoreDiv">
                        <h3 style="font-weight: 600;margin-top: 20px;">得分公式:</h3>
                        <div id="dfgs" style="font-size: 17px; font-weight: 700;"></div>
                        <div style="float: left;">
                        </div>
                    </div>
                </div>
            </div>

        </div><!-- /.main-content -->
        <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
            <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
        </a>

    </div><!-- /.main-container -->
</div>
<!-- footer -->
<script src="<s:url value="/assets/web/js/jquery.min.js?v=2.1.4"></s:url>"></script>
<link rel="stylesheet" href="<s:url value="/assets/web/css/login/bootstrap.min.css?v=3.3.6"></s:url>">
<script src="<s:url value="/assets/web/js/jqpaginator.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/baseAPI.js"></s:url>"></script>
<%--多选js--%>
<script src="<s:url value="/assets/web/js/multiSelect/js/fselect.js"></s:url>"></script>
<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"></script>

<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"></script>
<%@ include file="/WEB-INF/views/include/footer.jsp" %>
<!-- dialog -->
<%@ include file="/WEB-INF/views/include/dialog.jsp" %>


<script type="text/javascript">
    //基本路径
    var baseUrl = "<s:url value="/gradepoint"></s:url>/"
    //jqgrid的表格高度
    var height = 320;
    //jqgrid表格行头的中文
    var colNames = ['', '分数', '排名', '生成日期', '考核类别', '考核对象', '考核任务名', '考核任务单号', '责任单位', '考核内容', '考核更新时间', ''];
    var colModel = [

        {name: 'sysId', width: 60, hidden: true, key: true},
        {name: 'soucre', index: 'soucre', width: 50, editable: true, cellattr: addCellAttr},
        {name: 'rank', index: 'rank', width: 40, editable: true, cellattr: addCellAttr},
        {name: 'createDate', index: 'createDate', width: 100, editable: true},
        {name: 'checkType', index: 'checkType', width: 130, editable: true},
        {name: 'checkObject', index: 'checkObject', width: 100, editable: true},
        {name: 'taskName', index: 'taskName', width: 545, editable: true},
        {name: 'taskId', index: 'taskId', width: 190, editable: true},
        {name: 'resDept', index: 'resDept', width: 190, editable: true},
        {name: 'taskContent', index: 'taskContent', width: 500, editable: true},
        {name: 'updDate', index: 'updDate', width: 100, editable: true},
        {name: 'invalid', index: 'invalid', width: 50, hidden: true}
    ];

    //jqgrid的具体执行方法
    jqgrid({
        autoScroll: false,
        shrinkToFit: false,
        gridTableId: "#gridTable",
        gridPagerId: "#gridPager",
        onSelectRow: function (rowid, status) {
            rowids = $('#gridTable').jqGrid('getGridParam', 'selarrrow');
        },
        onSelectAll: function (aRowids, status) {
            rowids = $('#gridTable').jqGrid('getGridParam', 'selarrrow');
        },
        gridComplete: function () {
            var rowIds = jQuery("#gridTable").jqGrid('getDataIDs');
            for (var k = 0; k < rowIds.length; k++) {
                var flag = false;
                for (var i = 0; i < rowids.length; i++) {
                    if (rowids[i] == rowIds[k]) {
                        flag = true;
                        continue;
                    }
                }
                if (flag && flag == true) {
                    jQuery("#gridTable").setSelection(rowIds[k], true);
                }
            }

            //设置行颜色
            var ids = $("#gridTable").jqGrid("getDataIDs");//获取所有行的id
            var rowDatas = $("#gridTable").jqGrid("getRowData");//获取所有行的数据
            for (var ii = 0; ii < rowDatas.length; ii++) {
                var rowData = rowDatas[ii];
                if (rowData.invalid == 1) {//如果某一行中的“tax”为0，那就把这一整行的背景颜色设为红色
                    $("#" + ids[ii] + " td").css("background-color", "palegoldenrod");
                }
            }
        }
    });

    var rowids = [];//选中行id

    /**
     * 重写Array
     */
    Array.prototype.remove = function (val) {
        var index = this.indexOf(val);
        if (index > -1) {
            this.splice(index, 1);
        }
    };

    /**
     * 重写Array
     */
    Array.prototype.indexOf = function (val) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] == val) return i;
        }
        return -1;
    };
    //加载查询对话框
    // $("#queryDialog").load(getUrl("filter"));
    //重置表单
    function reset() {
        resetForm("#formDialog form");
    }

    /**
     * 导出表头选择
     */
    $("#exportTable").click(function () {
        loadDialog({
            dialogTitle: '导出绩效列表',
            dialogUrl: getUrl("formHead"),
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="exports()">确认</button>' +
                '<button type="button" class="btn btn-pink" onclick="reset()">重置</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>'
        });
    });

    $("#downLoad").click(function () {
        var url = "/gradepoint/download/gqXq82aIwmBSKcBR";
        console.log(url);
        window.open(url);
    });


    function exports() {
        var formHeads = $('#formDialogBody #formHeads').serialize();   //钩选表头数据
        // if (rowids.length == 0 || exportData == "") {
        //     alert("请先勾选要导出的项目或表头");
        //     return;
        // }
        var searchWord = $("#searchWord").val();
        var win = confirm("确认导出？");
        if (win == true) {
            var url = "/export/exportGradePointDetail?" + formHeads + "&searchWord=" + searchWord + "&sysIds=" + rowids;
            console.log(url);
            window.open(url);
        }
    }

    var exportData;
    //显示查询对话框
    var queryDialog = $("#queryDialog");

    // （新搜索）
    $("#query").click(function () {
        var url = '/gradepoint';
        var searchWord = $("#searchWord").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'searchWord': searchWord}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
        query();
    });

    //具体查询方法（新搜索）
    function query() {
        //统计得分
        $.ajax({
            type: "POST",
            url: "/gradepoint/getScoreNumCount",
            dataType: "json",
            data: exportData,
            success: function (model) {
                if (model.code == "200") {
                    console.log(model);
                    var content = '<table border="1" id = "userScoreTab_2">\n' +
                        "<tr><th>分数:</th>";
                    var content2 = "<tr><td>个数:</td>";
                    for (var i = 0; i < model.data.length; i++) {
                        var code = model.data[i].soucre;
                        var count = model.data[i].count;
                        content = content + "<th>" + code + "分</th>";
                        content2 = content2 + "<td>" + count + "个</td>";
                    }
                    content = content + "</tr>" + content2 + "</tr>";

                    var formula = "";
                    var totalScore = "";
                    var count = "";
                    var countInt = 0;
                    var totalScoreDouble = 0.0;
                    var resultScoreDouble = 0.0;
                    if (model.data != undefined) {
                        for (var i = 0; i < model.data.length; i++) {
                            if (model.data[i].soucre.indexOf("-") == -1 ? false : true) {
                                totalScore = totalScore + "-" + (model.data[i].soucre.replace("-", "") + "*" + model.data[i].count);
                            } else {
                                if (i > 0) {
                                    totalScore = totalScore + "+(" + (model.data[i].soucre + "*" + model.data[i].count) + ")";
                                } else {
                                    totalScore = totalScore + "(" + (model.data[i].soucre + "*" + model.data[i].count) + ")";
                                }
                            }
                            if (i > 0) {
                                count = count + "+" + model.data[i].count;
                            } else {
                                count = count + model.data[i].count;
                            }
                            //计算得分
                            if (model.data[i].soucre.indexOf("-") == -1 ? false : true) {
                                totalScoreDouble = totalScoreDouble - parseInt(model.data[i].count) * parseFloat(model.data[i].soucre.replace("-", ""));
                            } else {
                                totalScoreDouble = totalScoreDouble + parseInt(model.data[i].count) * parseFloat(model.data[i].soucre);
                            }
                            countInt = countInt + parseInt(model.data[i].count);
                        }
                        //最终得分
                        resultScoreDouble = totalScoreDouble / countInt + totalScoreDouble / 10;
                        //保留两位小数
                        resultScoreDouble = toDecimal2(resultScoreDouble);
                        //最终公式
                        formula = "(" + totalScore + ") /" + " (" + count + ")" + " + (" + totalScore + ") / 10 = " + resultScoreDouble;
                    }
                    content = content + '</table>';
                    //得分统计
                    $("#dftj").html(content);
                    //得分公式
                    $("#dfgs").html(formula);
                }
            },
            error: function (model) {
            }
        });
    }

    //更新操作
    $("#edits").click(function () {
        showEditView();
    });

    //考核汇总
    $("#showSummary").click(function () {
        window.location.href = '/scoresummary';
    });

    //考核记录
    $("#gradepoint").click(function () {
        window.location.href = '/gradepoint';
    });

    //催办操作
    $("#createLog").click(function () {
        showEditDialog({
            tableId: "#gridTable",
            dialogTitle: "更新对话框",
            dialogUrl: getUrl("createTaskLog"),
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="edit()" id="updatebtn" >更新</button>' +
                '<button type="button" class="btn btn-pink" onclick="reset()">重置</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>',
            errorTitle: "消息对话框",
            errorMutiSelectMessage: '您当前选中多行，请重新选择',
            errorUnSelectMessage: '您当前尚未选中一行，请选择后再试',
            errorOk: '确定'
        });
    });

    //执行更新操作
    function edit() {
        console.log("更新操作")
        executeSaveOrUpdate({
            formId: "#formDialog form",
            dialogId: "#formDialog",
            url: getUrl("edit"),
            tableId: "#gridTable",
            successMessage: "操作成功",
            successTitle: '操作对话框',
            //failMessage: '更新失败',
            failTitle: '消息对话框'
        });
    }

    //显示编辑对话框
    function showEditView() {
        showEditDialog({
            tableId: "#gridTable",
            dialogTitle: "更新对话框",
            dialogUrl: getUrl("edit"),
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="edit()" id="updatebtn" >更新</button>' +
                '<button type="button" class="btn btn-pink" onclick="reset()">重置</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>',
            errorTitle: "消息对话框",
            errorMutiSelectMessage: '您当前选中多行，请重新选择',
            errorUnSelectMessage: '您当前尚未选中一行，请选择后再试',
            errorOk: '确定'
        });
    }

    //双击显示对话框
    function showView() {
        showEditDialog({
            tableId: "#gridTable",
            dialogTitle: "绩效详情",
            dialogUrl: getUrl("showDetail"),
            dialogFoot: '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>',
            errorTitle: "消息对话框",
            errorMutiSelectMessage: '您当前选中多行，请重新选择',
            errorUnSelectMessage: '您当前尚未选中一行，请选择后再试',
            errorOk: '确定'
        });
    }


    //删除
    $("#delete").click(function () {
        showDeleteView();
    });

    //显示删除对话框
    function showDeleteView() {
        showDeleteDialog({
            url: getUrl("delete"),
            tableId: "#gridTable",
            confirmTitle: "确认对话框",
            confirmMessage: "是否确定删除?",
            confirmOk: "确定",
            confirmCancel: "取消",
            successMessage: "删除成功",
            successTitle: "消息对话框",
            failMessage: "删除失败",
            failTitle: "消息对话框",
            errorTitle: "警告提示框",
            errorMessage: "您当前尚未选中一行，请选择后再试",
            errorOk: "确定"
        });
    }

    //显示创建对话框
    $("#create").click(function () {
        loadDialog({
            dialogTitle: '创建对话框',
            dialogUrl: getUrl("create"),
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="create()">提交审核</button>' +
                '<button type="button" class="btn btn-pink" onclick="reset()">重置</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>'
        });
    });

    //分类编辑框
    $("#createCla").click(function () {
        loadDialog({
            dialogTitle: '创建对话框',
            dialogUrl: getUrl("createCla"),
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="create()">添加</button>' +
                '<button type="button" class="btn btn-pink" onclick="reset()">重置</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>'
        });
    });

    //保存数据
    function create() {
        executeSaveOrUpdate({
            formId: "#formDialog form",
            dialogId: "#formDialog",
            url: getUrl("create"),
            tableId: "#gridTable",
            successMessage: "保存成功",
            successTitle: '保存对话框',
            //failMessage: '保存失败',
            failTitle: '消息对话框'
        });
    }

    $("#gridTable").dblclick(function (e) {
        showView();
    });

    // function aa10Fmatter(cellvalue, options, rowObject) {
    //     if (cellvalue == "1") {
    //         return "有效任务";
    //     } else if (cellvalue == "0") {
    //         return "失效任务";
    //     }
    // }

    jQuery("#gridTable").jqGrid('setLabel', 0, '序号', 'labelstyle');

    $(function () {
        var branchType = '${user.branchType}';
        if (branchType == '2') {
            $(".userScoreDiv").css('display', 'none');//隐藏
        } else {
            $.ajax({
                type: "GET",
                url: "/gradepoint/getScoreAndRank",
                dataType: "json",
                data: {},
                success: function (model) {
                    var tableContent = " ";
                    if (model.code == "200") {

                        tableContent += '<table border="1" id = "userScoreTab">\n' +
                            '                    <tr>\n' +
                            '                        <th>用户名</th>\n' +
                            '                        <th>绩效得分</th>\n' +
                            // '                        <th>系统排名</th>\n' +
                            '                        <th>考核组别</th>\n' +
                            '                        <th>责任单位</th>\n' +
                            '                        <th>组内排名</th>\n' +
                            '                    </tr>';
                        tableContent += '<tr>\n' +
                            '                    <td>' + model.data.name + '</td>\n' +
                            '                    <td>' + model.data.finalScore + '</td>\n' +
                            // '                    <td>' + model.data.finalRank + '</td>\n' +
                            '                    <td>' + model.data.branchType + '</td>\n' +
                            '                    <td>' + model.data.branch + '</td>\n' +
                            '                    <td>' + model.data.itemRank + '</td>\n' +
                            '                    </tr>' +
                            '</table>';

                        //将拼接的页面放入列表里面
                        $("#yhdf").html(tableContent);
                    }
                },
                error: function (model) {
                }
            });
        }

        exportData = $('#formDialogBody #gradePointFilter').serialize();
        $.ajax({
            type: "POST",
            url: "/gradepoint/getScoreNumCount",
            dataType: "json",
            data: {},
            success: function (model) {
                if (model.code == "200") {
                    console.log(model);
                    var content = '<table border="1" id = "userScoreTab_2">\n' +
                        "<tr><th>分数:</th>";
                    var content2 = "<tr><td>个数:</td>";
                    for (var i = 0; i < model.data.length; i++) {
                        var code = model.data[i].soucre;
                        var count = model.data[i].count;
                        content = content + "<th>" + code + "分</th>";
                        content2 = content2 + "<td>" + count + "个</td>";
                    }
                    content = content + "</tr>" + content2 + "</tr>";

                    var formula = "";
                    var totalScore = "";
                    var count = "";
                    var countInt = 0;
                    var totalScoreDouble = 0.0;
                    var resultScoreDouble = 0.0;
                    if (model.data != undefined) {
                        for (var i = 0; i < model.data.length; i++) {
                            if (model.data[i].soucre.indexOf("-") == -1 ? false : true) {
                                totalScore = totalScore + "-" + (model.data[i].soucre.replace("-", "") + "*" + model.data[i].count);
                            } else {
                                if (i > 0) {
                                    totalScore = totalScore + "+(" + (model.data[i].soucre + "*" + model.data[i].count) + ")";
                                } else {
                                    totalScore = totalScore + "(" + (model.data[i].soucre + "*" + model.data[i].count) + ")";
                                }
                            }
                            if (i > 0) {
                                count = count + "+" + model.data[i].count;
                            } else {
                                count = count + model.data[i].count;
                            }
                            //计算得分
                            if (model.data[i].soucre.indexOf("-") == -1 ? false : true) {
                                totalScoreDouble = totalScoreDouble - parseInt(model.data[i].count) * parseFloat(model.data[i].soucre.replace("-", ""));
                            } else {
                                totalScoreDouble = totalScoreDouble + parseInt(model.data[i].count) * parseFloat(model.data[i].soucre);
                            }
                            countInt = countInt + parseInt(model.data[i].count);
                        }
                        //最终得分
                        resultScoreDouble = totalScoreDouble / countInt + totalScoreDouble / 10;
                        //保留两位小数
                        resultScoreDouble = toDecimal2(resultScoreDouble);
                        //最终公式
                        formula = "(" + totalScore + ") /" + " (" + count + ")" + " + (" + totalScore + ") / 10 = " + resultScoreDouble;
                    }
                    content = content + '</table>';
                    //得分统计
                    $("#dftj").html(content);
                    //得分公式
                    $("#dfgs").html(formula);
                }
            },
            error: function (model) {
            }
        });


    })

    /**
     * 给表格字体添加样式
     * @param rowId
     * @param val
     * @param rawObject
     * @param cm
     * @param rdata
     * @returns {string}
     */
    function addCellAttr(rowId, val, rawObject, cm, rdata) {
        return "style='color:red;font-weight:800;'";
    }

    /**
     *
     * @param x
     * @returns {string}
     */
    function toDecimal2(x) {
        var f = Math.round(x * 100) / 100;
        var s = f.toString();
        var rs = s.indexOf('.');
        if (rs < 0) {
            rs = s.length;
            s += '.';
        }
        while (s.length <= rs + 2) {
            s += '0';
        }
        return s;
    }

    //显示隐藏
    $(function () {
        //显示隐藏
        $(".clickMe").click(function () {
            if ($(this).text() === "更多∨") {
                $("#more_show").show(100);
                $(this).text("收起∧")
            } else if ($(this).text() === "收起∧") {
                $("#more_show").hide(100);
                $(this).text("更多∨");
            }
        });
    });

    //选择查询得分类型
    $("#invalid_select").change(function () {
        var url = '/gradepoint';
        var invalid = $("#invalid_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'invalid': invalid}, //发送数据
        }).trigger("reloadGrid"); //重新载入
    });

    //选择查询考核类别
    $("#checkType_select").change(function () {
        var url = '/gradepoint';
        var checkType = $("#checkType_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'checkType': checkType}, //发送数据
        }).trigger("reloadGrid"); //重新载入
    });
</script>

</body>
</html>